/var/www/technexus/src/Controllers/Blog.php
}
if (ctype_digit($this->peekPath()) && strlen($this->peekPath()) == 2) {
$month = $this->shiftPath();
}
$permalink = $this->peekPath()?$this->shiftPath():null;
if (empty($permalink) && empty($month)) {
return $this->year($year);
}
if (empty($permalink)) {
return $this->month($year, $month);
}
return $this->post($year, $month, $permalink??null);
default:
return $this->notfound();
}
}
public function getSidebarData()
{
return [
'Months' => DB::AllRecords(sprintf('SELECT DISTINCT MONTHNAME(`Created`) as `MonthName`,MONTH(`Created`) as `Month`, YEAR(`Created`) as `Year` FROM `%s` ORDER BY `Created` DESC', BlogPost::$tableName)),
'Tags' => PostTags::getAllbyQuery('SELECT *,COUNT(*) as `Count` FROM `'.PostTags::$tableName.'` GROUP BY `TagID` ORDER BY `Count` DESC'),
];
}
Arguments
"Undefined variable $month"
/var/www/technexus/src/Controllers/Blog.php
}
// month of posts
if (ctype_digit($this->peekPath()) && strlen($this->peekPath()) == 2) {
$month = $this->shiftPath();
}
// single post
$permalink = $this->peekPath()?$this->shiftPath():null;
// yearly digest
if (empty($permalink) && empty($month)) {
return $this->year($year);
}
// monthly digest
if (empty($permalink)) {
return $this->month($year, $month);
}
// specific single post
return $this->post($year, $month, $permalink??null);
default:
return $this->notfound();
}
}
/**
* Gets stuff that goes into the sidebar. All Months with blog posts and tags ordered by the amount of times that tag was used.
*
* @link project://views/blog/sidebar.twig
* @return array
*/
public function getSidebarData()
{
return [
'Months' => DB::AllRecords(sprintf('SELECT DISTINCT MONTHNAME(`Created`) as `MonthName`,MONTH(`Created`) as `Month`, YEAR(`Created`) as `Year` FROM `%s` ORDER BY `Created` DESC', BlogPost::$tableName)),
'Tags' => PostTags::getAllbyQuery('SELECT *,COUNT(*) as `Count` FROM `'.PostTags::$tableName.'` GROUP BY `TagID` ORDER BY `Count` DESC'),
];
}
/var/www/technexus/src/Controllers/Main.php
* @uses Blog::handleRequest()
* @return void
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/site.LOCK')) {
echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/down.html');
exit;
}
/*
* This is to make sure any page that loads
* through Apache's ErrorDocument returns 200
* instead of 404.
*/
header('HTTP/1.0 200 OK');
//header('X-Powered-By: PHP/' . phpversion() . ' Div Framework (http://emr.ge) Henry\'s Revision');
$blog = new Blog();
return $blog->handle($request);
}
}
/var/www/technexus/src/App.php
return true;
}
}
return false;
}
/**
* Gets difference between process start and now in microseconds.
*
* @return void
*/
public function getLoadTime()
{
return (microtime(true)-DIVERGENCE_START);
}
public function handleRequest()
{
$main = new Main();
$response = $main->handle(ServerRequest::fromGlobals());
(new Emitter($response))->emit();
}
}
/var/www/technexus/bootstrap/router.php
<?php
/**
* This file is part of the Divergence package.
*
* (c) Henry Paradiz <henry.paradiz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app->handleRequest();
/var/www/technexus/public/index.php
<?php
require(__DIR__.'/../bootstrap/autoload.php');
require(__DIR__.'/../bootstrap/app.php');
require(__DIR__.'/../bootstrap/router.php');
Arguments
"/var/www/technexus/bootstrap/router.php"